package org.busalerter.ui;

import ca.odell.glazedlists.gui.TableFormat;
import org.busalerter.domain.BusStop;

/**
 * Created by IntelliJ IDEA.
 * User: Andy
 * Date: 20/11/11
 * Time: 19:23
 * table format for bus stops
 */
public class BusStopTableFormat implements TableFormat<BusStop> {

    public int getColumnCount() {
        return 2;  //To change body of implemented methods use File | Settings | File Templates.
    }

    public String getColumnName(int column) {
        if(column == 0)      return "Name";
        else if(column == 1) return "Code";

        throw new IllegalStateException();
    }

    public Object getColumnValue(BusStop busStop, int column) {

        if(column == 0) return busStop.getName();
        else if(column == 1) return busStop.getBusStopCode();

        throw new IllegalStateException();
    }
}
